package com.north.light.androidutils.canvas.examprogress;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;

import com.north.light.androidutils.R;
import com.north.light.androidutils.canvas.examprogress.progress.ExamProgressBarView;
import com.north.light.androidutils.canvas.examprogress.step.ExamProgressStepView;

import org.jetbrains.annotations.NotNull;

/**
 * FileName: ExamProgressView
 * Author: lzt
 * Date: 2022/7/29 下午 3:00
 */
public class ExamProgressView extends RelativeLayout {

    private ExamProgressBarView progressBarView;
    private ExamProgressStepView progressStepView;

    public ExamProgressView(Context context) {
        super(context);
        init();
    }

    public ExamProgressView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public ExamProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        View rootView = LayoutInflater.from(getContext().getApplicationContext())
                .inflate(R.layout.view_exam_progress_layout, null);
        addView(rootView);

        progressBarView = rootView.findViewById(R.id.pbInfo);
        progressStepView = rootView.findViewById(R.id.psInfo);

    }

    public void setProgress(@NotNull ExamProgressBarInfo examProgressBarInfo) {
        progressBarView.setProgress(examProgressBarInfo);
        progressStepView.setProgress(examProgressBarInfo);

    }
}
